package com.aaa.sns.controller;

import com.aaa.common.entity.Order;
import com.aaa.sns.entity.TbComment;
import com.aaa.sns.service.OrderService;
import com.aaa.sns.service.TbCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * (TbComment)表控制层
 *
 * @author makejava
 * @since 2020-11-04 16:42:53
 */
@RestController
@RequestMapping("tbComment")
public class TbCommentController {
    /**
     * 服务对象
     */
    @Resource
    private TbCommentService tbCommentService;

    @Autowired
    private OrderService orderService;


    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Map selectOne(Long id) {
        TbComment tbComment= this.tbCommentService.queryById(id);
        List<Order> orders=orderService.selectOrderList();
        Map map =new HashMap();
        map.put("tbComment",tbComment);
        map.put("orders",orders);
        return map;
    }

}